<?php $this->load->view('header')?>
		<script src="/js/jquery/jquery-ui-1.8.14.custom.min.js" type="text/javascript"></script>
		<link href="/css/sso.css" rel="stylesheet" type="text/css">
		<link href="/css/jquery-ui-1.8.14.custom.css" rel="stylesheet" type="text/css">
		
		<script type="text/javascript">
		$(document).ready(function(){
			$("form input")
					.focus(function(){$(this).addClass("cur")})
					.blur(function() {$(this).removeClass("cur")});
		
			$("#sso_login").bind("click", function(){
				$("form").submit(function(){
					// var passed = true;
					// var msg = "";
					return validEmail() && validPwd() && validVercode();
				});
			});
		
			$("#email")
					.focus(function(){
						cleanDefEmail();
					})
					.blur(function(){
						setDefEmail();
			});
		
			if (parseEmail() == "") {
				setDefEmail();
			} else {
				$("#email").val(parseEmail());
			}
		});
		
		function validEmail() {
			var strm = $.trim($("#email").val());
			if(""==strm || strm == SAMPLE_EMAIL) {
				$("#err_msg").text('请输入邮箱地址！').show();
				return false;
			}
			if (strm.length > 64) {
				 $("#err_msg").text('邮箱格式错误，请重新输入！').show();
				 return false;
			}
			 var pattern = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
			 if (!pattern.test(strm)) {
		
			 $("#err_msg").text('邮箱格式错误，请重新输入！').show();
				return false;
			 }
			return true;
			}
		 function validPwd() {
			var strm = $.trim($("#pwd").val());
			if(""==strm) {
				$("#err_msg").text('请输入密码！').show();
				return false;
			}
				return true;
		 }
		 
		 function validVercode() {
			var strm = $.trim($("#vercode").val());
			if(""==strm) {
			  	$("#err_msg").text('请输入图形验证码！').show();
					return false;
			}
			return true;
		 }
		function clearLoginEmailErrMsg() {
		$("#err_emailMsg").text("");
		}
		
		function clearLoginPwdErrMsg() {
		$("#err_pwdMsg").text("");
		}
		function clearLoginVercodeErrMsg(){
		$("#err_vercodeMsg").text("");
		}
		/**
		 * 刷新图片验证码
		 */
		function refreshcode(){
			document.getElementById("vercode").value="";
			document.getElementById("vercode").focus();
			var verify=document.getElementById('imgVerCode'); 
			verify.setAttribute('src', '/user/genVcode?t=' + Math.random());  
		}
		
		/**
		 * 默认的邮箱格式样例
		 */
		var SAMPLE_EMAIL = "example@163.com";
		var SAMPLE_EMAIL_COLOR = "#aaa";
		var EMAIL_COLOR = "#494949";
		function cleanDefEmail() {
			if ($("#email").val() == SAMPLE_EMAIL) {
				$("#email").val("").css("color", EMAIL_COLOR);
			}
		}
		
		function setDefEmail() {
			if ($("#email").val() == "") {
				$("#email").val(SAMPLE_EMAIL).css("color", SAMPLE_EMAIL_COLOR);
			}
		}
		
		function parseEmail() {
			var url = window.location.href;
			var coms = url.split("&");
			for (var i = 0; i < coms.length; i++) {
				if (/^email=.+/.test(coms[i])) {
					return coms[i].split("=")[1];
				}
			}
			return "";
		}
		
		</script>

		<script language="Javascript" type="text/javascript">
			function trim (str) {
				var reg = /^\s+|\s+$/g;
				return str.replace(reg, "");
			}
			
			var Validator = {
			//检查EMAIL
			isEmail: function (str) {
			
			  var reg =  /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
			  var flag = reg.test(str);
			  return flag;
			},
			isMobileNum: function(str) {
				var reg = /^1\d{10}$/;
				var flag = reg.test(str);
				return flag;
			},
			//检查是否字母
			isAlpha: function (str) {
			  var reg = /^[A-z]+$/;
			  var flag = reg.test(str);
			  return flag;
			},
			//检查是否字母或数字
			isAlphaNumeric: function (str) {
			  var reg = /^[0123456789A-z]+$/;
			  var flag = reg.test(str);
			  return flag;
			},
			//检查是否字母或数字或中划线下划线
			isAlphaDash: function (str) {
			  var reg = /^[-_0123456789A-z]+$/;
			  var flag = reg.test(str);
			  return flag;
			},
			//检查是否数值
			isNumeric: function (str) {
			  var reg = /^-?[0-9]+\.?[0-9]*$/;
			  var flag = reg.test(str);
			  return flag;
			},
			//检查是否数字
			isDigital: function (str) {
			  var reg = /^[0-9]+$/;
			  var flag = reg.test(str);
			  return flag;
			},
			// 检查是否小于
			isLess: function(str, num) {
				return str.length < num;
			},
			// 检查是否大于
			isMore: function(str, num) {
				return str.length > num;
			},
			PWD_TOO_LONG: "请输入6～16位数字+字母组合",
			PWD_TOO_SHORT: "请输入6～16位数字+字母组合",
			PWD_TOO_SIMPLE: "密码过于简单，请输入字母与数字的组合",
			CONFIRM_PWD_MISMATCHED: "两次输入的密码不一致",
			VALID_MOBILE_NUM: "手机号码的格式不对(支持11位数字的手机号码)",
			IS_REQUIRED: "请输入",
			VALID_EMAIL: "请输入有效的邮箱地址",
			EMAIL_TOO_LONG: "邮箱地址太长，请输入有效的邮箱地址",
			COMPANY_NAME_TOO_LONG: "公司名字过长，请输入不超过50个字符",
			COMPANY_URL_TOO_LONG: "公司主页链接过长，请输入不超过256个字符",
			DONT_AGREE: "您没有同意服务协议"
		}
		</script>
		
		<div class="content" style="position:relative;">
			<div class="login_wp">
				<div class="login">
			    	<h3>Testin</h3>
					<div id="err_msg" class="error_msg" style="<?php if(!isset($errorMsg)){echo 'display:none;';}?>">
						<?php if(isset($errorMsg)){echo $errorMsg;}?>
					</div>
					<form method="post" action="<?php echo base_url('user/login');?>">
			      		<input name="domain" type="hidden" value="">
			      		<input name="ru" type="hidden" value="<?php echo base_url('user/login');?>">
				      	<ul>
				      		<li>
				          		<label>邮箱帐号 ：</label>
				          		<input id="email" name="user[email]" class="input_text" type="text" value="<?php if(isset($formInfo)){echo $formInfo['email'];}?>" style="color: rgb(170, 170, 170); " />
				        	</li>
				        	<li>
					    		<label>密码 ：</label>
				          		<input id="pwd" name="user[pwd]" class="input_text" type="password" value="" />
				        	</li>
				        	<li class="check_code">
								<label> 验证码 ：</label>
								<input id="vercode" name="vercode" class="input_text" type="text" value="" maxlength="4">
								<a href="#" onclick="refreshcode();" title="换一张">
									<img id="imgVerCode" name="imgVerCode" src="/user/genVcode" width="90" height="30" alt="">
					          		<em>换一张</em>
					          	</a>
							</li>
				        	<li class="auto_login"> 
					    		<a class="zhmm" href="<?php echo base_url('user/findPassword');?>" style="display:none;">
					          			找回密码
					    		</a>
					    		<label style="padding-right: 0px;width: 110px;">
					        		<input type="checkbox" name="authlogin" value="1" checked="checked">
					        		<span>下次自动登录 </span>
				        		</label>
				        	</li>
				        	<li class="login_button">
				        		<a class="zczh" href="<?php echo base_url('/user/register');?>">注册帐号</a>
								<button id="sso_login" type="submit" value="">登录</button>
							</li>
						</ul>
					</form>
				</div>
			</div>
			<div class="testin_video">
				<embed src="http://v.ifeng.com/include/exterior.swf?guid=7344fd52-2985-12dd-9120-c80bca8e38d0&amp;pageurl=http://www.ifeng.com&amp;fromweb=other&amp;AutoPlay=false" quality="high" allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="390" height="293" />
			</div>
		</div>
		
		<?php $this->load->view('footer')?>